<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>添加菜单</title>

    <include file="Base:header_js" />

    <style type="text/css">
        body{
            font-family: "微软雅黑",Helvetica,Tahoma,Arial,sans-serif;
        }
    </style>
</head>


<body>

    <div id="wrapper">

        <nav class="navbar-default navbar-static-side" role="navigation">
            <include file="Base:left_nav" />
        </nav>

        <div id="page-wrapper" class="gray-bg">
        <div class="row border-bottom">
            <nav class="navbar navbar-static-top" role="navigation" style="margin-bottom: 0;">
                <include file="Base:header" />
            </nav>

        </div>

        <div class="wrapper  animated fadeInRight">
            <br/>
            <div class="row">
                <div class="col-lg-12">
                    <div class="ibox-title">
                        <h5 style="margin-right:20px;"><a href="{:U('Admin/Menu/Index')}">后台菜单列表</a></h5>
                        <h5><a>添加菜单</a></h5>
                    </div>
                </div>
                <div class="col-lg-12">
                    <div class="ibox float-e-margins">
                        <div class="ibox-content">
                            <form method="post" class="form-horizontal" action="__SELF__">
                                <div class="form-group"><label class="col-sm-2 control-label">菜单名称</label>
                                    <div class="col-sm-4"><input type="text" name="name" class="form-control"></div>
                                </div>
                                <div class="form-group"><label class="col-sm-2 control-label">上级菜单</label>

                                    <div class="col-sm-4">
                                        <select class="form-control m-b" name="parent">
                                            <option value="0">顶级菜单</option>
                                            <volist name="menuArr" id="vo">
                                                <option value="{$vo.id}">{$vo.title_show}</option>
                                            </volist>
                                        </select>
                                    </div>
                                </div>
                                <div class="form-group"><label class="col-sm-2 control-label">菜单URL</label>
                                    <div class="col-sm-4"><input type="text" name="url" class="form-control"></div>
                                </div>
                                <div class="form-group"><label class="col-sm-2 control-label">菜单说明</label>
                                    <div class="col-sm-4"><input type="text" name="description" class="form-control"></div>
                                </div>
                                <div class="form-group"><label class="col-sm-2 control-label">菜单排序</label>
                                    <div class="col-sm-2"><input type="text"  name="sort"  value="0" class="form-control"></div>
                                </div>
                                <div class="form-group"><label class="col-sm-2 control-label">是否隐藏</label>

                                    <div class="col-sm-10">
                                      
                                        <div class="radio i-checks"><label> 
                                            <input type="radio" checked="" value="1" name="status"> <i></i>是</label>
                                        </div>
                                        <div class="radio i-checks"><label> 
                                            <input type="radio" checked="" value="0" name="status"> <i></i>否</label>
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group"><label class="col-sm-2 control-label">菜单类型</label>

                                    <div class="col-sm-3">
                                        <select class="form-control m-b" name="type">
                                            <option value="1">菜单+权限</option>
                                            <option value="0">普通菜单</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <div class="col-sm-4 col-sm-offset-2">
                                        <button class="btn btn-primary" type="submit">保存</button>
                                        <button class="btn btn-white" type="submit">返回</button>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
         <include file="Base:footer" />

        </div>
        </div>
    <include file="Base:footer_js" />
    <script type="text/javascript" src="__ADMIN_JS__/message.js"></script>
    <script type="text/javascript">
        $("form").submit(function(){
            var self = $(this);
            $.post(self.attr("action"), self.serialize(), success, "json");
            return false;

            function success(data){
                if(data.status){
                    var msg = new $.Messager(data.info, {type:'success' ,placement: 'center',time: 1000});
                    msg.show();
                    window.location.href = data.url;
                } else {
                    // var msg = new $.Messager(data.info, {placement: 'center',time: 1000});
                    // msg.show();
                    showMsg(data.info,data.url,'',2000);
                }
            }

            function showMsg(info , url , option ,time) {
                if(!option) {
                    option = {type: "default"};
                }
                var msg = new $.Messager(info, {type:option.type,placement: 'center',time: 1000});
                msg.show();
                setTimeout("location.href='http://www.baidu.com';", 1000);  
            }
        });
    </script>
</body>

</html>
